package com.zzcy.bt_print_plugin.bean;

import com.alibaba.fastjson.JSONObject;

/**
 * author : yzhg
 * 包名: io.dcloud.uniplugin.bean
 * 时间: 2024-09-18 14:02
 * 描述：
 */
public class MessageEvent<T> {

    // 前端传递过来的连接的操作
    public static final int BLUETOOTH_CONNECT_MESSAGE = 4000;
    // 蓝牙打印传递过来的数据
    public static final int BLUETOOTH_PRINTING_MESSAGE = 4001;

    private int type;
    private T data;
    private JSONObject jsonObject;
    private String content;

    public MessageEvent(int type) {
        this.type = type;
    }

    public MessageEvent(int type, JSONObject jsonObject) {
        this.type = type;
        this.jsonObject = jsonObject;
    }

    public MessageEvent(int type, T data, JSONObject jsonObject) {
        this.type = type;
        this.data = data;
        this.jsonObject = jsonObject;
    }

    public MessageEvent(int type, JSONObject jsonObject, String content) {
        this.type = type;
        this.jsonObject = jsonObject;
        this.content = content;
    }

    public String getContent() {
        return content == null ? "" : content;
    }

    public void setContent(String content) {
        this.content = content == null ? "" : content;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }


    public JSONObject getJsonObject() {
        return jsonObject;
    }

    public void setJsonObject(JSONObject jsonObject) {
        this.jsonObject = jsonObject;
    }
}
